/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.serc.pensieve.model;

import org.serc.pensieve.data.PreparationDao;
import org.serc.pensieve.uicontroller.UserRole;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
//import java.lang.Object;
//import net.sf.json.JSONObject;


/**
 *
 * @author Zeshan aman
 */
public class Preparation extends UserRole
{
    private String userName;
    private String password;
    private String role;
    public Preparation(String tempUname, String tempUpass, String tempUrole)
    {
       this.password = tempUpass;
       this.role = tempUrole;
       this.userName = tempUname;
    }


    @Override
    public int SaveErrosSnippets(String tempSRSID, String tempUsecase, String tempInspectionId, String selectedText, String textOfSnippet) {
        //throw new UnsupportedOperationException("Not yet implemented");


         PreparationDao prepDaoObj = new PreparationDao();
        int snippetSaving =  prepDaoObj.SaveErrosSnippets(tempSRSID,tempUsecase,tempInspectionId,selectedText,textOfSnippet);

        return 1;
    }

    @Override
    public  ArrayList<Inspection> GetNewInspectionData(int tempId)
    {

        
        PreparationDao getInspectionData = new PreparationDao();
         ArrayList<Inspection> tempInspection = new  ArrayList<Inspection>();
        try
        {
           tempInspection  =  getInspectionData.GetNewInspectionData(tempId);
        }
        catch (SQLException ex)
        {
            Logger.getLogger(Preparation.class.getName()).log(Level.SEVERE, null, ex);
        }
    return tempInspection;

    }
   // GetUseCases(srsId)

    @Override
    public  ArrayList<UseCases>  GetUseCases(int srsId)
    {
        
        PreparationDao getInspectionData = new PreparationDao();
         ArrayList<UseCases> tempInspection = new  ArrayList<UseCases>();
        //try
        //{
           tempInspection  =  getInspectionData.GetUseCases(srsId);
        //}
       // catch (SQLException ex)
        //{
          //  Logger.getLogger(Preparation.class.getName()).log(Level.SEVERE, null, ex);
        //}
    return tempInspection;

    }
   
    @Override
    public int createMeetings(String tempSRSID, String tempUsecase, String tempInspectionId) {
       // throw new UnsupportedOperationException("Not yet implemented");
    PreparationDao getInspectionData = new PreparationDao();
         int creatingmeetings;// = new  ArrayList<CheckList>();
        //try
        //{
           creatingmeetings  =  getInspectionData.createMeetings(tempSRSID,tempUsecase,tempInspectionId);
      
        
        return 1;
    }

    @Override
    public  ArrayList<CheckList> GetCheckList(int srsId)
    {
        PreparationDao getInspectionData = new PreparationDao();
         ArrayList<CheckList> tempInspection = new  ArrayList<CheckList>();
        //try
        //{
           tempInspection  =  getInspectionData.GetCheckList(srsId);
        //}
       // catch (SQLException ex)
        //{
          //  Logger.getLogger(Preparation.class.getName()).log(Level.SEVERE, null, ex);
        //}
    return tempInspection;

    }
//this methide should remove from here.
    @Override
    public ArrayList<String> SelectSRS()
    {
        throw new UnsupportedOperationException("Not supported yet.");
    }
//this methide should remove from here.


    @Override
    public boolean SavingState(int inspectionId,int usecaseID,int srsId,String errorDes,String passFailval)
    {
            PreparationDao savingState = new PreparationDao();
           boolean saving = false;
        try {
            saving = savingState.SavingState(inspectionId, usecaseID, srsId, errorDes, passFailval);
        } catch (SQLException ex) {
            Logger.getLogger(Preparation.class.getName()).log(Level.SEVERE, null, ex);
        }


        return saving;
    }

}
